home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / util / misc / csh547src.lha / shell.h < prev    next >
C/C++ Source or Header  |  1995-05-04  |  7KB  |  295 lines

  1. /*
  2.  * SHELL.H
  3.  *
  4.  * (c)1986 Matthew Dillon     9 October 1986
  5.  *
  6.  *
  7.  * SHELL include file.. contains shell parameters and extern's
  8.  *
  9.  * Version 2.07M by Steve Drew 10-Sep-87
  10.  * Version 4.01A by Carlo Borreo & Cesare Dieni 17-Feb-90
  11.  * Version 5.00L by Urban Mueller 16-Mar-91
  12.  *
  13.  */
  14.  
  15. #define RAW_CONSOLE 1   /* Set to 0 to compile out command line editing */
  16.  
  17. /* uncommented by AMK for SAS/C 6.1 */
  18. /* #define strlen strlen */
  19.  
  20. #ifdef _DCC
  21. # define C_Args
  22. # define FUNCARG(x,y,z) ()
  23. #else
  24. # define FUNCARG(x,y,z) (x,y,z)
  25. # define KICK20
  26. #endif
  27.  
  28.  
  29. /* AMK: more includes for OS 2.0 */
  30.  
  31. #include <exec/types.h>
  32. #include <exec/exec.h>
  33. #include <exec/memory.h>
  34. #include <graphics/gfxbase.h>
  35. #include <graphics/text.h>
  36. #include <intuition/intuitionbase.h>
  37. #include <libraries/dos.h>
  38. #include <libraries/dosextens.h>
  39. #include <libraries/gadtools.h>
  40. #include <libraries/asl.h>
  41. #include <time.h>
  42. #include <ctype.h>
  43. #include <fcntl.h>
  44. #include <stdio.h>
  45. #include <stdlib.h>
  46. #include <string.h>
  47. #include <math.h>
  48. #include <dos/datetime.h>
  49. #include <dos/dosextens.h>
  50. #include <dos/dostags.h>
  51. #include <dos/var.h>
  52. #include <utility/tagitem.h>
  53. #include <resources/battclock.h>
  54.  
  55.  
  56. /*
  57.  *  Magnus Lilja, lilja@lysator.liu.se, IRC: lilja - for multiuser-support
  58.  *  out-comment the following line if you don't have MultiUser installed
  59.  */
  60.  
  61. #define MULTIUSER_SUPPORT 1
  62.  
  63. #ifdef MULTIUSER_SUPPORT
  64. # include <libraries/multiuser.h>
  65. # include <proto/multiuser.h>
  66. # include <pragmas/multiuser.h>
  67.   extern struct muBase *muBase;
  68. #endif
  69.  
  70.  
  71.  
  72. LONG AllocPattern    (STRPTR, ULONG);
  73. LONG MatchThePattern (LONG, STRPTR);
  74. void FreePattern     (LONG);
  75.  
  76.  
  77.  
  78. typedef struct FileInfoBlock FIB;
  79.  
  80. #ifdef AZTEC_C
  81. # include <functions.h>
  82. # define DEVTAB(x)    (BPTR)(_devtab[x->_unit].fd)
  83. # define CHARSWAIT(x) (x->_bp < x->_bend)
  84. # define RESETIO(x)   (x->_bp = x->_bend)
  85. # define COMPILER "Aztec C 5.0d"
  86. # pragma amicall(PatternBase, 0x48, AllocPattern(a0,d0))
  87. # pragma amicall(PatternBase, 0x60, MatchThePattern(d0,a0))
  88. # pragma amicall(PatternBase, 0x66, FreePattern(d0))
  89. #endif
  90.  
  91. #ifdef LATTICE
  92. # include <proto/all.h>
  93. # include <ios1.h>
  94. /* # define DEVTAB(x)    _ufbs[(x)->_file].ufbfh*/
  95. # define DEVTAB(x)    __ufbs[(x)->_file].ufbfh
  96. # define CHARSWAIT(x) (x->_rcnt != x->_wcnt)
  97. # define RESETIO(x)   (x->_rcnt =  x->_wcnt)
  98.  
  99.   /* AMK: already defined in <ios1.h>, extern struct UFB _ufbs[];*/
  100. # ifndef memmove
  101. # define memmove(t,f,l) movmem((f),(t),(l))
  102. # endif
  103. # define COMPILER "SAS/C 6"
  104. # define swapmem(x,y,z) swmem(x,y,z)
  105. # pragma libcall PatternBase AllocPattern 48 0802
  106. # pragma libcall PatternBase MatchThePattern 60 8002
  107. # pragma libcall PatternBase FreePattern 66 001
  108. #endif
  109.  
  110. #ifdef _DCC
  111. # define COMPILER "DICE 2.06"
  112. # define DEVTAB(x)    (_IoFD[x->sd_Fd].fd_Fh)
  113. # define CHARSWAIT(x) (x->sd_RPtr != x->sd_RBuf)
  114. # define RESETIO(x)   (x->sd_RPtr =  x->sd_RBuf)
  115. # define index strchr
  116. # define rindex strrchr
  117.   void * AllocMem(long byteSize, long requirements);
  118.   struct MsgPort *FindPort( UBYTE *name );
  119. #endif
  120.  
  121. #undef  toupper
  122. #define toupper(c)    ((c)>='a'&&(c)<='z'?((c)-('a'-'A')):(c))
  123.  
  124. #ifndef MAX
  125. #define MAX(x,y) ((x)>(y) ? (x) : (y))
  126. #endif
  127.  
  128. #define OPT(x) (options & (x))
  129.  
  130. #define MAXSRC        5        /* Max. # of source file levels    */
  131. #define MAXIF        20        /* Max. # of if levels            */
  132. #define MAXALIAS    20        /* Max. # of alias levels        */
  133. #define MAXMYFILES    9        /* Max. # of internal files        */
  134. #define MAXHASH        32        /* Max. # of hash chains        */
  135. #define MAXFILENAME    30
  136.  
  137. #define LEVEL_SET        0        /* which variable list to use   */
  138. #define LEVEL_ALIAS        1
  139. #define LEVEL_LABEL        2
  140. #define LEVEL_LOCAL        256
  141.  
  142. #define SBYTE signed char
  143. #define MAXMENUS    31    /* GadTools maximum */
  144. #define MAXMENUITEMS    63    /* GadTools maximum */
  145.  
  146. #define VERBOSE_SOURCE 1
  147. #define VERBOSE_ALIAS  2
  148. #define VERBOSE_HILITE 4
  149.  
  150. #define SCAN_FILE     1
  151. #define SCAN_DIR      2
  152. #define SCAN_RECURSE  4
  153. #define SCAN_DIRENTRY 8
  154. #define SCAN_DIREND   16
  155.  
  156. #ifndef NULL
  157. #define NULL 0L
  158. #endif
  159.  
  160. #define CHECKBREAK() dobreak()
  161. #define ISSPACE(c) ((c)==' ' || (c)==9 || (UBYTE)(c)==0xA0)
  162.  
  163. #ifndef AZTEC_C
  164. struct _dev {
  165.     long  fd;
  166.     short mode;
  167.     };
  168. #endif
  169.  
  170. typedef struct hnode {
  171.     struct hnode *next, *prev;        /* doubly linked list */
  172.     char *line;                /* line in history    */
  173. } HIST;
  174.  
  175. typedef struct PErr {
  176.     int errnum;                /* Format of global error lookup */
  177.     char *errstr;
  178. } PERROR;
  179.  
  180. #ifdef MA_AMK
  181. #undef MA_AMK
  182. #endif
  183. /* #define MA_AMK 1 /* */
  184. typedef struct dirptr {                /* Format of directory fetch pointer */
  185.     BPTR lock;                /* lock on directory   */
  186.     FIB *fib;                /* mod'd fib for entry */
  187. #ifdef MA_AMK
  188.     struct DevProc *dvp;            /* for multi-assigns */
  189.     char *dname;                /* for multi-assigns */
  190. #endif
  191. } DPTR;
  192.  
  193. extern HIST *H_head, *H_tail;
  194. extern PERROR Perror[];
  195. extern char **av;
  196. extern char *Current;
  197. extern int  H_len, H_tail_base, H_stack, H_num;
  198. extern int  E_stack;
  199. extern int  Src_stack, If_stack, forward_goto;
  200. extern int  ac;
  201. extern int  max_ac;
  202. extern int  debug, Rval, Verbose, disable, Quit;
  203. extern int  Lastresult, atoierr;
  204. extern int  Exec_abortline;
  205. extern int  S_histlen;
  206. extern unsigned int options;
  207.  
  208. extern FILE *Src_base[MAXSRC];
  209. extern long  Src_pos[MAXSRC];
  210. extern short Src_if[MAXSRC], Src_abort[MAXSRC];
  211. extern char  If_base[MAXIF];
  212. extern struct Process *Myprocess;        /* The shell's process  */
  213. extern struct CommandLineInterface *Mycli;    /* Cli() */
  214. extern struct DosPacket *Mypacket;        /* initialization packet from AmigaDOS */
  215.  
  216. extern char v_titlebar[], v_prompt[], v_hist[], v_histnum[], v_debug[],
  217.     v_verbose[], v_stat[], v_lasterr[], v_cwd[], v_except[], v_passed[],
  218.     v_path[], v_gotofwd[], v_linenum[], v_every[], v_lcd[], v_rxpath[],
  219.     v_hilite[], v_scroll[], v_minrows[], v_result[], v_qcd[], v_noreq[],
  220.     v_value[], v_nobreak[], v_bground[], v_pipe[], v_datefmt[], v_ioerr[],
  221.     v_abbrev[], v_rback[], v_insert[], v_failat[], v_clipri[],
  222.     v_dirformat[], v_nomatch[], v_prghash[], v_cquote[], v_mappath[],
  223.     v_timeout[], v_promptdep[], v_complete[];
  224.  
  225. extern char o_hilite[], o_lolite[], *o_rback, *o_csh_qcd, o_internal;
  226. extern char o_aux, o_minrows, o_scroll, o_nowindow, o_noraw, o_vt100;
  227. extern char o_nofastscr, o_nobreak, o_bground, o_resident, o_nomatch;
  228. extern char o_cquote, o_mappath, *o_complete;
  229. extern char o_pipe[], o_datefmt, o_abbrev, o_insert, *o_every;
  230. extern long o_noreq, o_failat, o_timeout, o_promptdep;
  231. extern char Buf[], isalph[], confirmed, asked, *classfile;
  232.  
  233. extern char *MyMem;
  234.  
  235. #define isalphanum(x) isalph[x]
  236.  
  237. typedef struct file_info {
  238.     LONG flags;
  239.     LONG type;
  240.     LONG size;
  241.     LONG blocks;
  242.     char class[12];
  243.     struct DateStamp date;
  244.     UWORD uid;
  245.     UWORD gid;
  246. } FILEINFO;
  247.  
  248. typedef struct pattern {
  249.     int  casedep;
  250.     int  queryflag;
  251.     LONG patptr;
  252.     char pattern[1];
  253. } PATTERN;
  254.  
  255. #define INFO_COMMENT (1<<30)
  256. #define INFO_INFO    (1<<29)
  257.  
  258. typedef struct Class {
  259.     struct Class *next;
  260.     char name[1];
  261. } CLASS;
  262.  
  263. extern CLASS *CRoot, *LastCRoot;
  264. extern struct Window *Mywindow;
  265.  
  266. extern long IoError;
  267.  
  268. typedef struct VNode {
  269.     struct VNode *next;
  270.     long len;
  271.     char *text;
  272.     char name[1];
  273. } NODE;
  274.  
  275. typedef struct VRoot {
  276.     NODE         *first[MAXHASH];
  277.     struct VRoot *parent;
  278. } ROOT;
  279.  
  280. struct PathList {
  281.     BPTR pl_NextPath;
  282.     BPTR pl_PathLock;
  283. };
  284.  
  285. /* internal programm path hash-list */
  286. extern char **prghash_list;
  287. extern long prghash_num;
  288.  
  289. #include "proto.h"
  290. #include "WindowBounds.h"
  291.  
  292. /* DEBUG */
  293. #include <mindebug.h>
  294.  
  295.